PIO SPECIFIC STUFF ONLY

From original file:

a41
Adding PIO conrol commands:
PIO INIT MACHINE pio%, statemachine%, clockspeed [,pinctrl] [,execctrl]
 [,shiftctrl]

e.g.
Dim a%(7)=(&H0001E000E101E081,0,0,0,0,0,0,0)
SetPin 1,pio0
PIO program 0,a%()
PIO init machine 0,0,100000
PIO start 0,0

generates a square wave on pin-1 at 1/4 of the clock frequency requested.

------------------------
a42
Lots of new stuff to control the PIO system.

* PIO Commands *
Immediately executes the instruction on the pio and state machine specified.
PIO EXECUTE pio, state_machine, instruction%

writes the data elements to the pio and state machine specified. The write
is blocking so the state machine needs to be able to take the data supplied
NB: this command will probably need additional capability in future releases
PIO WRITE pio, state_machine, count, data0 [,data1....]

reads the data elements from the pio and state machine specified. The read
is non-blocking so the stat machine needs to be able to supply the data
requested. NB: this command will probably need additional capability in future
releases
PIO READ pio, state_machine, count, data%()

This says to set up a statemachine for the specified PIO with a given clock
speed. The user is then required to specify the three registers which control
how the PIO will operate. See the manual for details. It is anticipated that
eventually the assembler will be able to generate the register values for the
user along with the program array based on the defined assembler directives.
something in Basic
PIO INIT MACHINE pio, statemachine, clockspeed, PINCTRL register
EXECCTRL register, SHIFTCTRL register

Starts or restarts a specific state machine
PIO START pio, statemachine

Stops a specific state machine
PIO STOP pio, statemachine 


* PIO() Functions *
helper function to calculate the value of pinctrl for the INIT MACHINE command 
PIO(PINCTRL no_side_set_pins [,no_set_pins] [,no_out_pins] [,IN base]
 [,side_set_base] [,set_base]) 

helper function to calculate the value of execctrl for the INIT MACHINE command
PIO(EXECCTRL jmp_pin ,wrap_target, wrap

helper function to calculate the value of shiftctrl for the INIT MACHINE command 
PIO(SHIFTCTRL push_threshold [,pull_threshold] [,autopush] [,autopull])

returns the value of the FSTAT register for the pio specified
PIO(FSTAT pio)

returns the value of the FSDEBUG register for the pio specified
PIO(FDEBUG pio)

returns the value of the FLEVEL register for the pio specified
PIO(FLEVEL pio)

------------------------
a44
New PIO Commands:

This stops the pio specified on all statemachines and clears the control
registers for the statemachines PINCTRL, EXECTRL, and SHIFTCTRL to defaults
PIO CLEAR pio

Programs just the specified line in a PIO program
PIO PROGRAM LINE pio, line, instruction

e.g. run the program
Dim a%(7)=(&H0001E000E101E081,0,0,0,0,0,0,0)
SetPin 1,pio0
PIO program 0,a%()
PIO init machine 0,0,100000
PIO start 0,0

The at the command prompt type
PIO PROGRAM LINE 0,1, &Hef01

and see the waveform change

A complete program can also be done like this, even at the command line

setpin 1,pio0
pio clear 0
pio program line 0,0,&He081
pio program line 0,1,&He101
pio program line 0,2,&He000
pio program line 0,3,1
pio init machine 0,0,1000000
pio start 0,0

------------------------
